package org.black.phoneUtility.app.activity;

import org.black.phoneUtility.R;
import org.black.phoneUtility.app.fragment.PasswordProtectionFragment;

import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class PreMainActivity extends Activity {
	private static final String LOG_TAG = PreMainActivity.class.getName();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		getActionBar().setDisplayHomeAsUpEnabled(false);
		setContentView(R.layout.premain_main);
		FragmentManager fragmentManager = getFragmentManager();
		Fragment fragment = new PasswordProtectionFragment();

		Intent intent = getIntent();
		Bundle bundle = intent.getExtras();
		if (bundle == null) {
			// should test password
		} else {
			// if password pass, start main
		}
		fragment.setArguments(bundle);

		fragmentManager
				.beginTransaction()
				.replace(R.id.premain_main_content_frame, fragment,
						PasswordProtectionFragment.TAG).commit();
	}

	@Override
	public void finish() {
		Log.v(LOG_TAG, "finish");
		super.finish();
	}

	@Override
	protected void onDestroy() {
		Log.v(LOG_TAG, "onDestroy");
		super.onDestroy();
	}

}
